from core.basehandler import BaseHandler
from core.room import Room
from core.support import set_cutscene, get_game
from core.action import Action
from items.wine import Wine

class NetworkingHall(Room):
    def __init__(self, room_id ):
        Room.__init__(self, room_id)    # do basic initialization for every room
        self.wine_drunk = False
        # add inventory items
        
        # build list of actions
        self.add_action(Fight)
        self.add_action(Exit)
    
    # return description of room.
    def get_description(self):
        if self.wine_drunk:
            return "You notice a small door in the wall." 
        else:
            return "Suddenly, the hall fills up with C level Executives. In order to get to the other end of the hall, you must network your way through!" 
    # return image of room
    def get_image(self):
        return 'networking.jpg'
    
    def drink_wine(self):
        self.add_action(Skip)

class NetworkingHallHandler(BaseHandler):
    
    # return class to use to create a new instance of this room
    def get_room_class(self):
        return NetworkingHall

class Fight(Action):
    def __init__(self):
        Action.__init__(self, "Fight")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Start Networking!"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'fourthFloorArena'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"


class Exit(Action):
    def __init__(self):
        Action.__init__(self, "Exit")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Turn around and run!"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'fourthFloor'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"

class Skip(Action):
    def __init__(self):
        Action.__init__(self, "Skip")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Go through the Door"

    # set cutscene for when arrive in entrance_hall
    def do_action(self,game,room,request):
        set_cutscene("You have found a secret passageway to the end of the hall!")
        return
        
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'fourthFloorTreasure'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"    